#include <stdio.h>
#include <unistd.h>

int main()
{
    int i = 10;
    pid_t ret = fork();
    if(ret < 0)
    {
        printf("ret : %d\n", ret);
        return -1;
    }
    else if(ret == 0)
    {
        //child
        i += 10;
        while(1)
        {
            printf("i am child , pid is : %d, i = %d\n",getpid(), i);
            printf("my father is %d\n", getppid());
            sleep(1);
        }
    }
    else
    {
        //father
        {
            printf("i am father , pid is : %d, i = %d\n",getpid(), i);
            printf("my father is %d\n", getppid());
            sleep(20);
        }
    }

    return 0;
}
